print(Sys.time())

options(stringsAsFactors=F)

suppressPackageStartupMessages(library(readr))
suppressPackageStartupMessages(library(plyr))
suppressPackageStartupMessages(library(dplyr))


russia_short <- suppressMessages(read_delim(
    "data/ira_tweets_csv_hashed.csv",
    delim=",", comment="", quote="\"", n_max = 10
)) #only used for n columns

russia <- read_delim(
    "data/ira_tweets_csv_hashed.csv",
    delim=",", comment="", quote="\"", 
    col_types=paste(rep("c", ncol(russia_short)), collapse="")
)

russia <- subset(
    russia,
    substr(tweet_time, 1, 10) >= "2016-01-01"
    & substr(tweet_time, 1, 10) <= "2016-11-08"
)

head(russia)

russia_ids <- russia[,c("tweetid", "tweet_text", "tweet_time")]

save(
    russia_ids,
    file="data/russia_ids_replicate_psrm.RData"
)

print(Sys.time())
